home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
WEEKCOMP.TAS
< prev
next >
Wrap
Text File
|
1992-02-14
|
2KB
|
85 lines
{ WEEKCOMP.TAS
This script will compress daily data to true
weekly data and create an ASCII output file that PML
can read.
The format of the output file is
SYMBOL,YYMMDD,HIGH,LOW,CLOSE,VOL
or
SYMBOL,YYMMDD,OPEN,HIGH,LOW,CLOSE,VOL,OPEN INT
depending on whether there is OPEN information
in the daily file.
Author : Martin Moore Feb 14, 1992
}
#output_file WEEKLY.PRN N
#max_quotes 250
W_open : number;
W_oi : number;
W_high : number;
W_low : number;
W_close : number;
W_volume: number;
W_date : number;
MondayAt = 0;
WeekDay = 0;
PriorDay = DayWk(DATES[1]);
for i = 1; i <= QUOTE_COUNT; i = i+1;
BEGIN
WeekDay = DayWk(DATES[i]);
{ is it Monday or later?}
if WeekDay >= 1 then
begin
if MondayAt = 0 then
begin
W_open = OPEN[i];
W_oi = OI[i];
MondayAt = i;
end;
end;
{ check if it is the last day of the week}
if WeekDay < PriorDay then
begin
GoSub doFriday;
end;
PriorDay = WeekDay;
END;
If MondayAt <> 0 And WeekDay <> 5 then
Gosub DoFriday;
Return;
{ *****************************
** doFriday: **********
Subroutine to print out the
summary for the week,
assumes that the current
index "i" is the day following
the Friday or end of week
*****************************}
:doFriday
weekRange = i - MondayAt;
k = i-1;
{ adjust for HHV etc}
Quote_Range = k;
if k > weekRange
weekRange = weekRange+1;
W_high = HHV(H,weekRange);
W_low = LLV(L,weekRange);
W_close = C[k];
W_volume = SUM(V,weekRange);
W_date = DATES[k];
{ reset quote range}
Quote_Range = Quote_Count;
MondayAt = 0;
PriorDay = 7;
write(trim(TICKER),',',
format(W_date,'%6.0f'),',');
if OPEN[k] <> 0.0 then
write(W_open,',');
write(W_high,',',
W_low,',',
W_close,',',
Format(W_volume,'%8.0f'));
if OPEN[k] <> 0.0 then
write(W_oi);
writeln();
Return;